package trading.ctm.yunjing.module.auction.adapter

import android.content.Intent
import android.widget.LinearLayout
import cc.vv.lkbasecomponent.base.ui.adapter.LKBaseSingleAdapter
import cc.vv.lkbasecomponent.base.ui.adapter.viewholder.LKBaseViewHolder
import trading.ctm.yunjing.R
import trading.ctm.yunjing.module.auction.activity.AuctionDetailsActivity

class AuctionAdapter : LKBaseSingleAdapter<String, LKBaseViewHolder>{

    constructor(resId: Int, data: List<String>): super(resId, data){

    }

    override fun convert(helper: LKBaseViewHolder?, item: String?) {
        super.convert(helper, item)
        val adapterPosition = helper?.adapterPosition as Int
        val view = helper.getView<LinearLayout>(R.id.ll_hav_layout)
        if(adapterPosition % 2 == 0){
            view.setBackgroundResource(R.color.color_FBF7F5)
        } else {
            view.setBackgroundResource(R.color.color_FFFFFF)
        }
        view.setOnClickListener {
            mContext.startActivity(Intent(mContext, AuctionDetailsActivity::class.java))
        }
    }
}